package mop.exception;

/**
 * Exception class to be thrown when a duplicate has been encountered
 * 
 * @author	 MOP Team 7
 */
public class InsufficientPermissionException extends Throwable 
{

	/**
	 * Initializes an InsufficientPermissionException with the passed action
	 * 
	 * @param action	Action performed that gave error
	 *  
	 * @post	Sets the action
	 */
	public InsufficientPermissionException(String action)
	{
		this.action = action;
	}
	
	/**
	 * Return a error message that can be used by the gui
	 * @return An error message describing the invalid action
	 */
	public String toString()
	{
		StringBuffer sb = new StringBuffer();
		sb.append("You don't have permission to perform the following action:\n ");
		sb.append(action);
		return sb.toString();
	}
	

	
	/**
	 * Weird java demand
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * The action thats causing the problem
	 */
	private final String action;
	
}